<template>
  <div>
    <h3>帅鹏黑店</h3>
    <MyProduct v-for="item in list"  :key="item.id" :message="item"  @sale='kanPrice' > </MyProduct>
   </div>
</template>
 
<script>
/* 父传子 */
import MyProduct from "./components/MyProduct.vue"

export default {

  components: {
    MyProduct
  },
  props: {},
  data() {
    return {
      list: [
        {
          id: 1,
          proname: '超级好吃棒棒糖',
          proprice: 188,
          low: 160,
          desc: '甜'
        },
        {
          id: 2,
          proname: '超级好吃的大鸡腿',
          proprice: 360,
          low: 320,
          desc: '香'
        },
        { id: 3, 
        proname: '超级无敌冰激凌',
         proprice: 42, 
         low: 30,
        desc: '冰'
           }
      ]
    };
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    kanPrice(value){
   this.list.forEach(item=>{if(item.id === value ){item.proprice >item.low?  item.proprice-= 10 :alert('不能再低了，要破产了')}})
  
    }
  }
};
</script>

<style scoped>
     
</style>